<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .active {
      color: red;
    }

    .p {
      font-size: 30px;
    }
  </style>
</head>

<body>

  <div id="app">
    <!-- <p v-bind:id="aa">p111111111</p> -->
    <!-- <p v-bind:class="className">p2222222222</p> -->
    <!-- <p :class="{aa:true,bb:true}">p2222222222</p> -->
    <!-- <p :class="{p:true, active:isActive}">p2222222222</p> -->
    <p :class="['aa','bb','p',isActive ? 'active' : '' ]">p333333333</p>
    <button @click="change">切换</button>
  </div>
  <!-- 引入vue文件 -->
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  <script>
    const app = new Vue({
      el: '#app',
      data: {
        aa: 'apple',
        className: '',
        isActive: false
      },
      methods: {
        change() {
          // if (this.className == '') {
          //   this.className = 'active'
          // } else {
          //   this.className = ''
          // }

          this.isActive = !this.isActive
        }
      }
    })

  </script>
</body>

</html>